<style type="text/css">

</style>

<div class="col-md-12 mt20">
  <div class="panel panel-default">
    <div class="panel-body">
      <div class="col-md-4">
        <input type="text" class="form-control" placeholder="套餐名称" ng-model="searchform.name">
      </div>
      <div class="col-md-2">
        <ui-select ng-model="searchform.status" theme="bootstrap">
          <ui-select-match placeholder="产品分类">{{$select.selected.name}}</ui-select-match>
          <ui-select-choices repeat="item.value as item in searchform.statusList">
            <span ng-bind-html="item.name | highlight: $select.search"></span>
          </ui-select-choices>
        </ui-select>
      </div>
      <div class="col-md-2 pull-right">
        <button class="btn btn-success search btn-block" ng-click="updatePackage()">添加套餐</button>
      </div>
      <div class="col-md-2 pull-right">
        <button class="btn btn-info search btn-block" ng-click="search(1)">立即搜索</button>
      </div>
    </div>
    
    <div class="panel-body">
      <table class="table table-striped table-bordered dataTable">
        <thead>
          <tr>
            <th class="text-center" style="width: 17%">套餐名称</th>
            <th class="text-center" style="width: 13%">套餐编号</th>
            <th class="text-center" style="width: 10%">是否试用</th>
            <th class="text-center" style="width: 10%">状态</th>
            <th class="text-center" style="width: 10%">排序</th>
            <th class="text-center" style="width: 15%">操作</th>
          </tr>
        </thead>
        <tbody>
          <tr ng-repeat="obj in list">
            <td>{{obj.name}}</td>
            <td class="text-center">{{obj.code}}</td>
            <td class="text-center">{{obj.is_try=='0'?'不可试用':'可试用 '+obj.is_try+' 天'}}</td>
            <td class="text-center">{{obj.status=='1'?'已上架':'未上架'}}</td>
            <td class="text-center">{{obj.sort}}</td>
            <td class="text-center">
              <button type="button" class="btn btn-primary btn-xs" ng-show="obj.status!='1'" ng-click="setStatus(obj,'1')">上架</button>
              <button type="button" class="btn btn-primary btn-xs" ng-show="obj.status=='1'" ng-click="setStatus(obj,'0')">下架</button>
              <button type="button" class="btn btn-info btn-xs" ng-show="obj.status!='1'" ng-click="updatePackage(obj)">编辑</button>
              <button type="button" class="btn btn-danger btn-xs" ng-show="obj.status!='1'" ng-click="delete(obj)">删除</button>
            </td>
          </tr>
        </tbody>
      </table>
      <div class="text-right">
        <pagination total-items="totalItems" ng-model="currentPage" ng-change="search(currentPage)" 
        previous-text="上一页" next-text="下一页" first-text="首页" last-text="尾页" boundary-links="true" 
        rotate="false" max-size="5" items-per-page="itemsPerPage" class="m-b"></pagination>
      </div>

    </div>
  </div>
</div>